<template>
    <div>
        <div class="e-form" v-if="dialogVisible === false">
            <BillTop :title="$route.meta.title" @cancel="handleClose"></BillTop>
            <div class="tabs warningTabs"></div>
            <div class="tabs" v-if="Object.keys(formData).length != 0">
                <el-tabs
                    tab-position="left"
                    v-model="tabsName"
                    @tab-click="onChangeTab"
                    v-if="auditState.canModify"
                >
                    <!-- 基本信息 -->
                    <el-tab-pane
                        label="基本信息"
                        name="baseInfo"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="包件信息"
                        name="detail"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="采购清单"
                        name="tenderList"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="公文文件"
                        name="files"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="采购条款"
                        name="clause"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="附件信息"
                        name="attach"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="审核历史"
                        name="auditHistory"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="补遗记录"
                        name="recodes"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane label="报名记录" name="reg" :disabled="clickTabFlag"></el-tab-pane>
                    <el-tab-pane
                        label="评标结果记录"
                        name="bidEvaluation"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="招标公示记录"
                        name="biddingPublicity"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="中标通知书记录"
                        name="bidWinningNotice"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="关闭记录"
                        name="close"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <div>
                        <div id="baseInfoCon" class="con">
                            <div class="tabs-title" id="baseInfo">基本信息</div>
                            <el-form
                                :model="formData"
                                label-width="170px"
                                :rules="rules"
                                ref="ruleForm"
                            >
                                <el-row>
                                    <el-col :span="12">
                                        <el-form-item label="采购编号" width="230" prop="billNo">
                                            <span>{{ formData.billNo }}</span>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="12">
                                        <el-form-item label="采购人" width="230" prop="tenderUser">
                                            <ComInputSelectUnit
                                                :orgName.sync="formData.tenderUser"
                                                :orgId.sync="formData.tenderUserId"
                                                :SelectedIDs="
                                                    formData.tenderUserId !== ''
                                                        ? [formData.tenderUserId]
                                                        : []
                                                "
                                                type="getParentOrg"
                                            />
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-row>
                                    <el-col :span="12">
                                        <el-form-item label="采购方式" prop="tenderForm">
                                            <el-select
                                                v-model="formData.tenderForm"
                                                placeholder="请选择"
                                                @change="selectChange($event, '采购方式')"
                                            >
                                                <el-option
                                                    v-for="item in options.tenderForm"
                                                    :key="item.value"
                                                    :label="item.label"
                                                    :value="item.value"
                                                >
                                                </el-option>
                                            </el-select>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="12">
                                        <el-form-item
                                            label="拟采购项目名称"
                                            width="200"
                                            prop="tenderName"
                                        >
                                            <el-input v-model="formData.tenderName"></el-input>
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-row>
                                    <el-col :span="12">
                                        <el-form-item label="申请日期" prop="applyTime">
                                            <el-date-picker
                                                v-model="formData.applyTime"
                                                type="date"
                                                placeholder="选择日期"
                                                :clearable="false"
                                                value-format="yyyy-MM-dd"
                                            >
                                            </el-date-picker>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="12">
                                        <!-- 需要id和name -->
                                        <el-form-item
                                            label="申请单位"
                                            width="230"
                                            prop="applyOrgName"
                                        >
                                            <ComInputSelectUnit
                                                :orgName.sync="formData.applyOrgName"
                                                :orgId.sync="formData.applyOrgId"
                                                :SelectedIDs="
                                                    formData.applyOrgId !== ''
                                                        ? [formData.applyOrgId]
                                                        : []
                                                "
                                            />
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-row>
                                    <el-col :span="12">
                                        <el-form-item
                                            label="采购公告"
                                            prop="tenderNotice"
                                            v-if="
                                                formData.tenderForm !== '2' &&
                                                formData.tenderForm !== '4'
                                            "
                                        >
                                            <el-button
                                                style="width: 222px"
                                                class="btn-greenYellow"
                                                @click="handleNotice"
                                                >招标公告</el-button
                                            >
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="12">
                                        <el-form-item label="录入机构" prop="orgName">
                                            <span>{{ formData.orgName }}</span>
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-row>
                                    <el-col :span="12">
                                        <el-form-item label="投标保证金（元）" prop="tenderBail">
                                            <el-input
                                                v-model="formData.tenderBail"
                                                v-enterJustFloat
                                                @blur="inputblur(formData, 'tenderBail')"
                                            ></el-input>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="12">
                                        <el-form-item label="币种" prop="currencyId">
                                            <el-select
                                                v-model="formData.currencyId"
                                                placeholder="请选择"
                                                @change="selectChange($event, '币种')"
                                            >
                                                <el-option
                                                    v-for="item in options.currency"
                                                    :key="item.kvValue"
                                                    :label="item.kvKey"
                                                    :value="item.kvValue"
                                                >
                                                </el-option>
                                            </el-select>
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-row>
                                    <el-col :span="12">
                                        <el-form-item label="投标截止时间" prop="tenderEndTime">
                                            <el-date-picker
                                                v-model="formData.tenderEndTime"
                                                type="datetime"
                                                placeholder="选择日期时间"
                                                value-format="yyyy-MM-dd HH:mm:ss"
                                            >
                                            </el-date-picker>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="12">
                                        <el-form-item
                                            label="拟采购金额（元）"
                                            width="200"
                                            prop="tenderAmount"
                                        >
                                            <span>{{ formData.tenderAmount }}</span>
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-row>
                                    <el-col :span="12">
                                        <el-form-item label="购买标书费用（元）" prop="bidCharge">
                                            <el-input
                                                v-model="formData.tenderFee"
                                                v-enterJustFloat
                                                @blur="inputblur(formData, 'tenderFee')"
                                            ></el-input>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="12">
                                        <el-form-item
                                            label="发布到招采平台"
                                            prop="pushPurchasePlatformState"
                                        >
                                            <el-radio
                                                v-model="formData.pushPurchasePlatformState"
                                                :label="1"
                                                :disabled="formData.tenderForm === '1'"
                                                >是</el-radio
                                            >
                                            <el-radio
                                                v-model="formData.pushPurchasePlatformState"
                                                :label="0"
                                                :disabled="formData.tenderForm === '1'"
                                                >否</el-radio
                                            >
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-row>
                                    <el-col :span="12">
                                        <el-form-item label="税额" width="200" prop="taxAmount">
                                            <span>{{ formData.taxAmount }}</span>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="12">
                                        <el-form-item label="状态">
                                            <span>{{ formData.state | state(this) }}</span>
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <ComNullify :formData="formData" />
                                <el-row>
                                    <el-form-item
                                        label="采购需求陈述"
                                        prop="purchaseDemandStatement"
                                    >
                                        <el-input
                                            type="textarea"
                                            :rows="2"
                                            placeholder="请输入内容"
                                            v-model="formData.purchaseDemandStatement"
                                            style="margin-right: 110px"
                                        >
                                        </el-input>
                                    </el-form-item>
                                </el-row>
                                <el-row>
                                    <el-form-item label="备注信息">
                                        <el-input
                                            type="textarea"
                                            :rows="2"
                                            placeholder="请输入内容"
                                            v-model="formData.remarks"
                                            style="margin-right: 110px"
                                        >
                                        </el-input>
                                    </el-form-item>
                                </el-row>
                                <el-row>
                                    <el-col :span="12">
                                        <el-form-item label="本位币" prop="baseCurName">
                                            <!-- 传id和名称 -->
                                            <span>{{ formData.baseCurName }}</span>
                                        </el-form-item>
                                    </el-col>
                                    <el-col
                                        :span="12"
                                        v-if="formData.baseCurName !== formData.currency"
                                    >
                                        <el-form-item label="人民币汇率" prop="rmbRate">
                                            <span>{{ formData.rmbRate }}</span>
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-row>
                                    <el-col :span="12" v-if="formData.releaseState === 1">
                                        <el-form-item label="发布时间：">
                                            <!-- 传id和名称 -->
                                            <span>{{ formData.relaseTime }}</span>
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                            </el-form>
                        </div>

                        <div id="detailCon" class="con">
                            <div class="tabs-title" id="detail">包件信息</div>
                            <div>
                                <ComDetailsOfProposedIndex
                                    ref="ComDetailsOfProposedIndex"
                                    :tenderData="formData"
                                    v-model="detailsData"
                                    @onChangeTab="onChangeTab"
                                    :tenderListData="tenderListData"
                                    :auditState="auditState"
                                />
                            </div>
                        </div>

                        <div id="tenderListCon" class="con">
                            <div class="tabs-title" id="tenderList">采购清单</div>
                            <ComtenderListIndex
                                ref="ComtenderListIndex"
                                :detailsData="detailsData"
                                v-model="tenderListData"
                                :auditState="auditState"
                                @onChangeTab="onChangeTab"
                            />
                        </div>

                        <div id="filesCon" class="con">
                            <div class="tabs-title" id="files">公文文件</div>
                            <ComFilesIndex
                                ref="ComFilesIndex"
                                com="equipmentBidding"
                                :auditState="auditState"
                            />
                        </div>

                        <!-- <div id="clauseCon" class="con" style="padding-bottom: 0">
                            <div class="tabs-title" id="clause">采购条款</div>
                            <div style="height: 800px">
                                <iframe
                                    id="iframe"
                                    :src="formData.tenderClausePath"
                                    style="width: 100%; height: 99%"
                                    frameborder="0"
                                ></iframe>
                            </div>
                        </div> -->

                        <div id="attachCon" class="con">
                            <div class="tabs-title" id="attach">附件信息</div>
                            <ComAttachIndex
                                bucketName="tender"
                                :relationId="billId"
                                ref="ComAttachIndex"
                                :isView="
                                    (auditState.canAudit === false &&
                                        auditState.canModify === false) ||
                                    Object.keys(auditState).length === 0
                                "
                                :key="1"
                                v-if="Object.keys(auditState).length !== 0"
                            />
                        </div>

                        <!-- billType 工程施工招标6021 其他工程招标6022 物资供应招标6028 物资加工招标6024
                    周材租赁招标6025 服务采购招标6026 机材收入招标6027 设备采购招标6028
                    设备租赁招标6029 -->
                        <div id="auditHistoryCon" class="con">
                            <div class="tabs-title" id="auditHistory">审核历史</div>
                            <ComExaHistory :billType="6028" ref="ComExaHistory" />
                        </div>

                        <div id="recodesCon" class="con">
                            <div class="tabs-title" id="recodes">补遗记录</div>
                            <ComTenderAddendumIndex />
                        </div>

                        <div id="regCon" class="con">
                            <div class="tabs-title" id="reg">报名记录</div>
                            <ComOpenBiddingRegIndex />
                        </div>

                        <div id="bidEvaluationCon" class="con">
                            <div class="tabs-title" id="bidEvaluation">评标结果登记</div>
                            <ComBidEvaluationResultIndex />
                        </div>

                        <div id="biddingPublicityCon" class="con">
                            <div class="tabs-title" id="biddingPublicity">招标结果公示</div>
                            <ComBiddingResultIndex />
                        </div>

                        <div id="bidWinningNoticeCon">
                            <div class="tabs-title" id="bidWinningNotice">中标通知书</div>
                            <ComBidWinningNoticeIndex />
                        </div>

                        <div id="closeCon" class="con">
                            <div class="tabs-title" id="close">关闭记录</div>
                            <ComBidClosingIndex />
                        </div>
                    </div>
                </el-tabs>
                <el-tabs tab-position="left" v-model="tabsName" @tab-click="onChangeTab" v-else>
                    <!-- 基本信息 -->
                    <el-tab-pane
                        label="基本信息"
                        name="baseInfo"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="包件信息"
                        name="detail"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="采购清单"
                        name="tenderList"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="公文文件"
                        name="files"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="采购条款"
                        name="clause"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="附件信息"
                        name="attach"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="审核历史"
                        name="auditHistory"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="补遗记录"
                        name="recodes"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane label="报名记录" name="reg" :disabled="clickTabFlag"></el-tab-pane>
                    <el-tab-pane
                        label="评标结果记录"
                        name="bidEvaluation"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="招标公示记录"
                        name="biddingPublicity"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="中标通知书记录"
                        name="bidWinningNotice"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="关闭记录"
                        name="close"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <div>
                        <div id="baseInfoCon" class="con">
                            <div class="tabs-title" id="baseInfo">基本信息</div>
                            <el-form
                                :model="formData"
                                label-width="170px"
                                :rules="rules"
                                ref="ruleForm"
                            >
                                <el-row>
                                    <el-col :span="12">
                                        <el-form-item label="采购编号" width="230" prop="billNo">
                                            <span>{{ formData.billNo }}</span>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="12">
                                        <el-form-item label="采购人" width="230" prop="tenderUser">
                                            <ComInputSelectUnit
                                                :orgName.sync="formData.tenderUser"
                                                :orgId.sync="formData.tenderUserId"
                                                :SelectedIDs="
                                                    formData.tenderUserId !== ''
                                                        ? [formData.tenderUserId]
                                                        : []
                                                "
                                                :edit="false"
                                            />
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-row>
                                    <el-col :span="12">
                                        <el-form-item label="采购方式" prop="tenderForm">
                                            <span>{{
                                                formData.tenderForm | tenderForm(this)
                                            }}</span>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="12">
                                        <el-form-item
                                            label="拟采购项目名称"
                                            width="200"
                                            prop="tenderName"
                                        >
                                            <span>{{ formData.tenderName }}</span>
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-row>
                                    <el-col :span="12">
                                        <el-form-item label="申请日期" prop="applyTime">
                                            <span>{{ formData.applyTime }}</span>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="12">
                                        <!-- 需要id和name -->
                                        <el-form-item
                                            label="申请单位"
                                            width="230"
                                            prop="applyOrgName"
                                        >
                                            <ComInputSelectUnit
                                                :orgName.sync="formData.applyOrgName"
                                                :orgId.sync="formData.applyOrgId"
                                                :SelectedIDs="
                                                    formData.applyOrgId !== ''
                                                        ? [formData.applyOrgId]
                                                        : []
                                                "
                                                :edit="false"
                                            />
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-row>
                                    <el-col :span="12">
                                        <el-form-item
                                            label="采购公告"
                                            prop="tenderNotice"
                                            v-if="
                                                formData.tenderForm !== '2' &&
                                                formData.tenderForm !== '4'
                                            "
                                        >
                                            <el-button
                                                style="width: 222px"
                                                class="btn-greenYellow"
                                                @click="handleNotice"
                                                >招标公告</el-button
                                            >
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="12">
                                        <el-form-item label="录入机构" prop="orgName">
                                            <span>{{ formData.orgName }}</span>
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-row>
                                    <el-col :span="12">
                                        <el-form-item label="投标保证金（元）" prop="tenderBail">
                                            <span>{{ formData.tenderBail }}</span>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="12">
                                        <el-form-item label="币种" prop="currencyId">
                                            <span>{{
                                                formData.currencyId | currencyId(this)
                                            }}</span>
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-row>
                                    <el-col :span="12">
                                        <el-form-item label="投标截止时间" prop="tenderEndTime">
                                            <span>{{ formData.tenderEndTime }}</span>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="12">
                                        <el-form-item
                                            label="拟采购金额（元）"
                                            width="200"
                                            prop="tenderAmount"
                                        >
                                            <span>{{ formData.tenderAmount }}</span>
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-row>
                                    <el-col :span="12">
                                        <el-form-item label="购买标书费用（元）" prop="tenderFee">
                                            <span>{{ formData.tenderFee }}</span>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="12">
                                        <el-form-item
                                            label="发布到招采平台"
                                            prop="pushPurchasePlatformState"
                                        >
                                            <el-radio
                                                v-model="formData.pushPurchasePlatformState"
                                                :label="1"
                                                disabled
                                                >是</el-radio
                                            >
                                            <el-radio
                                                v-model="formData.pushPurchasePlatformState"
                                                :label="0"
                                                disabled
                                                >否</el-radio
                                            >
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-row>
                                    <el-col :span="12">
                                        <el-form-item label="税额" width="200" prop="taxAmount">
                                            <span>{{ formData.taxAmount }}</span>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="12">
                                        <el-form-item label="状态">
                                            <span>{{ formData.state | state(this) }}</span>
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <ComNullify :formData="formData" />
                                <el-row>
                                    <el-form-item
                                        label="采购需求陈述"
                                        prop="purchaseDemandStatement"
                                    >
                                        <span>{{ formData.purchaseDemandStatement }}</span>
                                    </el-form-item>
                                </el-row>
                                <el-row>
                                    <el-form-item label="备注信息">
                                        <span>{{ formData.remarks }}</span>
                                    </el-form-item>
                                </el-row>
                                <el-row>
                                    <el-col :span="12">
                                        <el-form-item label="本位币" prop="baseCurName">
                                            <!-- 传id和名称 -->
                                            <span>{{ formData.baseCurName }}</span>
                                        </el-form-item>
                                    </el-col>
                                    <el-col
                                        :span="12"
                                        v-if="formData.baseCurName !== formData.currency"
                                    >
                                        <el-form-item label="人民币汇率" prop="rmbRate">
                                            <span>{{ formData.rmbRate }}</span>
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-row>
                                    <el-col :span="12" v-if="formData.releaseState === 1">
                                        <el-form-item label="发布时间：">
                                            <!-- 传id和名称 -->
                                            <span>{{ formData.relaseTime }}</span>
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                            </el-form>
                        </div>

                        <div id="detailCon" class="con">
                            <div class="tabs-title" id="detail">包件信息</div>
                            <div>
                                <ComDetailsOfProposedIndex
                                    ref="ComDetailsOfProposedIndex"
                                    :tenderData="formData"
                                    v-model="detailsData"
                                    @onChangeTab="onChangeTab"
                                    :tenderListData="tenderListData"
                                    :auditState="auditState"
                                />
                            </div>
                        </div>

                        <div id="tenderListCon" class="con">
                            <div class="tabs-title" id="tenderList">采购清单</div>
                            <ComtenderListIndex
                                ref="ComtenderListIndex"
                                :detailsData="detailsData"
                                v-model="tenderListData"
                                :auditState="auditState"
                            />
                        </div>

                        <div id="filesCon" class="con">
                            <div class="tabs-title" id="files">公文文件</div>
                            <ComFilesIndex
                                ref="ComFilesIndex"
                                com="equipmentBidding"
                                :auditState="auditState"
                            />
                        </div>

                        <!-- <div id="clauseCon" class="con" style="padding-bottom: 0">
                            <div class="tabs-title" id="clause">采购条款</div>
                            <div style="height: 800px">
                                <iframe
                                    id="iframe"
                                    :src="formData.tenderClausePath"
                                    style="width: 100%; height: 99%"
                                    frameborder="0"
                                ></iframe>
                            </div>
                        </div> -->

                        <div id="attachCon" class="con">
                            <div class="tabs-title" id="attach">附件信息</div>
                            <ComAttachIndex
                                bucketName="tender"
                                :relationId="billId"
                                ref="ComAttachIndex"
                                :isView="
                                    (auditState.canAudit === false &&
                                        auditState.canModify === false) ||
                                    Object.keys(auditState).length === 0
                                "
                                :key="2"
                                v-if="Object.keys(auditState).length !== 0"
                            />
                        </div>

                        <!-- billType 工程施工招标6021 其他工程招标6022 物资供应招标6028 物资加工招标6024
                    周材租赁招标6025 服务采购招标6026 机材收入招标6027 设备采购招标6028
                    设备租赁招标6029 -->
                        <div id="auditHistoryCon" class="con">
                            <div class="tabs-title" id="auditHistory">审核历史</div>
                            <ComExaHistory :billType="6028" ref="ComExaHistory" />
                        </div>

                        <div id="recodesCon" class="con">
                            <div class="tabs-title" id="recodes">补遗记录</div>
                            <ComTenderAddendumIndex />
                        </div>

                        <div id="regCon" class="con">
                            <div class="tabs-title" id="reg">报名记录</div>
                            <ComOpenBiddingRegIndex />
                        </div>

                        <div id="bidEvaluationCon" class="con">
                            <div class="tabs-title" id="bidEvaluation">评标结果登记</div>
                            <ComBidEvaluationResultIndex />
                        </div>

                        <div id="biddingPublicityCon" class="con">
                            <div class="tabs-title" id="biddingPublicity">招标结果公示</div>
                            <ComBiddingResultIndex />
                        </div>

                        <div id="bidWinningNoticeCon">
                            <div class="tabs-title" id="bidWinningNotice">中标通知书</div>
                            <ComBidWinningNoticeIndex />
                        </div>

                        <div id="closeCon" class="con">
                            <div class="tabs-title" id="close">关闭记录</div>
                            <ComBidClosingIndex />
                        </div>
                    </div>
                </el-tabs>
            </div>
            <div id="seat" :style="{ height: seatHeight + 'px' }"></div>
            <!-- 招标通用 -->
            <div class="buttons" v-if="$route.query.isview === undefined">
                <ComBidButtons
                    :formData="formData"
                    api="equipmentProcurement"
                    ref="ComBidButtons"
                    :releaseState="false"
                    releaseType="1"
                    @getData="getData"
                />
                <ComExaButtons
                    :auditState="auditState"
                    @exas="exas"
                    :routeTo="
                        () => {
                            this.$router.push('./equipmentBiddingApplication')
                        }
                    "
                    :founderId="formData.founderId"
                    :state="formData.state"
                    :isPrint="false"
                />
                <!-- <el-button type="primary" class="btn-blue" size="small">打印</el-button> -->
                <el-button @click="handleClose" size="small">取消</el-button>
            </div>
            <div class="buttons-seize-a-seat"></div>
        </div>
        <!-- dialog -->
        <ComNoticeDialog
            ref="ComNoticeDialog"
            :dialogVisible.sync="dialogVisible"
            :tenderClass="parseInt(formData.tenderClass)"
            :tenderForm="String(formData.tenderForm)"
            v-if="Object.keys(formData).length !== 0"
            :content="formData.tenderNotice"
            @save="noticeSave"
            :canEdit="auditState.canModify"
        />
    </div>
</template>

<script>
import '@/utils/jquery.scrollTo.min'
import applyRequest from '@/api/tender/apply.js'
import auditRequest from '@/api/tender/audit.js'
import equipmentProcurementRequest from '@/api/tender/equipmentProcurement.js'
import authRequest from '@/api/identity/auth.js'
import commonRequest from '@/api/tender/common.js'
// import ComPagination from '@/components/pagination/pagination.vue'
import ComTenderAddendumIndex from '@/pages/bidding/equipmentBidding/tenderAddendum/tenderAddendumIndex'
import ComBidClosingIndex from '@/pages/bidding/equipmentBidding/bidClosing/bidClosingIndex'
import ComBiddingResultIndex from '@/pages/bidding/equipmentBidding/biddingResult/biddingResultIndex'
import ComBidEvaluationResultIndex from '@/pages/bidding/equipmentBidding/bidEvaluationResult/bidEvaluationResultIndex'
import ComBidWinningNoticeIndex from '@/pages/bidding/equipmentBidding/bidWinningNotice/bidWinningNoticeIndex'
import ComOpenBiddingRegIndex from '@/pages/bidding/equipmentBidding/openBiddingReg/openBiddingRegIndex'
import ComDetailsOfProposedIndex from '@/pages/bidding/equipmentBidding/detailsOfProposed/detailsOfProposedIndex'
import ComAttachIndex from '@/components/common/attachIndex'
import ComFilesIndex from '@/pages/bidding/common/filesIndex'
import ComtenderListIndex from '@/pages/bidding/equipmentBidding/tenderList/tenderListIndex'
import ComExaButtons from '@/components/common/exaButtons'
import ComBidButtons from '@/components/bidding/bidButtons'
import ComExaHistory from '@/components/common/exaHistory.vue'
import ComNoticeDialog from '@/components/common/noticeDialog.vue'
import ComInputSelectUnit from '@/pages/bidding/common/inputSelectUnit.vue'
import ComNullify from '@/pages/bidding/common/nullify.vue'
// import ComAuditHistoryIndex from '@/pages/bidding/laborBidding/auditHistory/auditHistoryIndex'
import { openAppClient } from '@/utils/common'
import { mapState, mapMutations } from 'vuex'
// import axios from 'axios'
// import store from '@/store'

export default {
    data () {
        const not0RmbRate = (rule, value, callback) => {
            if (typeof value === 'number' && value === 0) {
                return callback(new Error('人民币汇率不能为0'))
            } else {
                callback()
            }
        }
        const greaterZero = (rule, value, callback) => {
            if (typeof value === 'number' && value < 0) {
                return callback(new Error('不能为负数'))
            } else {
                callback()
            }
        }
        return {
            tabsName: 'baseInfo',
            screenWidth: 0,
            screenHeight: 0,
            lastConHeight: 0,
            clickTabFlag: false, // 如果手动点击时，则不做滚动事件逻辑，只有滚动屏幕时才走滚动事件逻辑
            form: {
                name: '',
                region: '',
                date1: '',
                date2: '',
                delivery: false,
                type: [],
                resource: '',
                desc: ''
            },
            tableData: [],
            value: '',
            textarea: '',
            formData: {},
            currentTabComponentName: '',
            selectData: [],
            orgSelectTableColumnAttr: [
                {
                    label: '机构Id',
                    prop: 'orgId'
                },
                {
                    label: '机构名称',
                    prop: 'orgName'
                }
            ],
            docSelectTableColumnAttr: [
                {
                    label: '序号'
                },
                {
                    label: '文件编号',
                    prop: 'docNum'
                },
                {
                    label: '公文文件名称',
                    prop: 'name'
                },
                {
                    label: '备案时间',
                    prop: 'oaCreateTime'
                },
                {
                    label: '备案人',
                    prop: 'userName'
                }
                // {
                //     label: '上传时间',
                //     prop: ''
                // }
            ],
            selectTableColumnWidth: {
                leftWidth: '150',
                rightWidth: '100'
            },
            selectDataPagination: {},
            loadComponent: new Set(),
            cloneFormDataStr: '',
            // 招标单据
            // 工程施工招标6021 其他工程招标6022 物资供应招标6028 物资加工招标6024 周材租赁招标6025 服务采购招标6026 机材收入招标6027 设备采购招标6028 设备租赁招标6029
            auditParams: {
                billId: this.$route.query.tenderId || this.$route.query.billid,
                billType: 6028,
                freeNextUnitIndex: 0,
                freeNextUser: '',
                isPass: true,
                isShareInAudit: true,
                opinion: ''
            },
            nullifyParams: {
                billId: this.$route.query.tenderId || this.$route.query.billid,
                billType: 6028,
                nullifyCreated: '',
                nullifyCreator: '',
                nullifyCreatorId: '',
                nullifyDescription: '',
                nullifyReason: ''
            },
            auditState: {
                // canModify: false
            },
            dialogVisible: false,
            rules: {
                billNo: { required: true, message: '请输入招标编号', trigger: 'blur' },
                tenderName: { required: true, message: '请输入拟招标项目名称', trigger: 'blur' },
                tenderForm: { required: true, message: '请选择招标方式', trigger: 'change' },
                tenderType: { required: true, message: '请选择招标类型', trigger: 'change' },
                projectName: { required: true, message: '请输入项目名称', trigger: 'blur' },
                tenderNotice: { required: true, message: '请输入公告', trigger: 'change' },
                tenderBail: [
                    { required: true, message: '请输入投标保证金（元）', trigger: 'blur' },
                    // { type: 'number', message: '保证金必须为数字值' },
                    { validator: greaterZero, trigger: 'blur' }
                ],
                currencyId: { required: true, message: '请选择币种', trigger: 'change' },
                tenderAmount: {
                    required: true,
                    message: '请输入拟招标金额（元）',
                    trigger: 'blur'
                },
                // taxAmount: { required: true, message: '请输入税额', trigger: 'blur' },
                applyTime: { required: true, message: '请选择申请日期', trigger: 'change' },
                tenderState: { required: true, message: '请输入招标状态', trigger: 'blur' },
                state: { required: true, message: '请输入申请状态', trigger: 'blur' },
                applyOrgName: { required: true, message: '请选择申请单位', trigger: 'change' },
                projectOverview: {
                    required: true,
                    message: '请输入招标项目工程概况',
                    trigger: 'blur'
                },
                remarks: [
                    // { required: true, message: '请输入备注', trigger: 'blur' },
                    { max: 500, message: '最多允许输500个汉字', trigger: 'blur' }
                ],
                orgName: { required: true, message: '请输入录入机构', trigger: 'blur' },
                tenderUser: { required: true, message: '请选择招标单位', trigger: 'change' },
                baseCurName: {
                    required: true,
                    message: '没有设置本位币，请联系集团信息化管理员设置！',
                    trigger: 'blur'
                },
                rmbRate: [
                    { required: true, message: '请选择币种', trigger: 'change' },
                    { validator: not0RmbRate, trigger: 'change' }
                ],
                centralizedPurchasingState: {
                    required: true,
                    message: '请选择集中采购',
                    trigger: 'change'
                },
                tenderFee: [
                    { required: true, message: '请输入购买标书费用', trigger: 'blur' },
                    { type: 'number', message: '购买标书费用必须为数字值' },
                    { validator: greaterZero, trigger: 'blur' }
                ],
                tenderEndTime: { required: true, message: '请选择投标截止时间', trigger: 'change' },
                pushPurchasePlatformState: {
                    required: true,
                    message: '请选择发布到招采平台',
                    trigger: 'change'
                },
                purchaseDemandStatement: {
                    required: true,
                    message: '请输入采购需求陈述',
                    trigger: 'blur'
                }
            },
            tenderListData: [],
            detailsData: []
        }
    },
    watch: {
        detailsData: {
            handler (val) {
                // 计算拟采购金额
                this.formData.tenderAmount = val.reduce((prev, cur) => (prev += cur.priceLimit), 0)
                // 计算税额
                this.formData.taxAmount = parseFloat(
                    val
                        .reduce((prev, cur) => (prev += cur.taxAmount + cur.freightTax), 0)
                        .toFixed(2)
                )
            },
            deep: true
        },
        'formData.tenderForm': {
            handler (val) {
                if (val === '1') {
                    this.formData.pushPurchasePlatformState = 1
                }
            },
            immediate: true
        }
    },
    computed: {
        // 填补底部空白，以使高度够滚动
        seatHeight () {
            return this.screenHeight - 40 - this.lastConHeight
        },
        ...mapState({
            options: state => state.biddingApplication.dictionaries
        }),
        tenderId () {
            return this.$route.query.tenderId || this.$route.query.billid
        },
        billId () {
            return this.$route.query.billid
        }
    },
    components: {
        // ComPagination,
        ComTenderAddendumIndex,
        ComBidClosingIndex,
        ComBiddingResultIndex,
        ComBidEvaluationResultIndex,
        ComBidWinningNoticeIndex,
        ComOpenBiddingRegIndex,
        ComDetailsOfProposedIndex,
        ComAttachIndex,
        ComFilesIndex,
        ComtenderListIndex,
        ComBidButtons,
        ComExaButtons,
        ComExaHistory,
        ComNoticeDialog,
        ComInputSelectUnit,
        ComNullify
        // ComAuditHistoryIndex
    },
    async created () {
        const promise1 = await this.getData()
        const promise2 =
            this.formData.state === -1 || this.formData.state === 2 || this.formData.state === 5
                ? null
                : this.getCurrentUnitInfo()
        Promise.all([promise1, promise2]).then(() => {
            // 不请求审核接口也需要给附件v-if显示
            if (Object.keys(this.auditState).length === 0) {
                this.auditState.canModify = false
                this.auditState.canAudit = false
            }
            this.ifSeat()
        })
        // setTimeout(() => {
        //     console.log('detailsData', this.detailsData)
        // }, 3000)
    },
    mounted () {
        // 保存所有tabName
        const arr = [
            'baseInfo',
            'detail',
            'tenderList',
            'files',
            'clause',
            'attach',
            'auditHistory',
            'recodes',
            'reg',
            'bidEvaluation',
            'biddingPublicity',
            'bidWinningNotice',
            'close'
        ]
        // 获取最后一个内容区域的高度，计算底部空白
        this.getLastConHeight(arr)
        let $idsTop = []
        window.addEventListener('scroll', () => {
            // 如果手动点击时，则不做滚动事件逻辑，只有滚动屏幕时才走滚动事件逻辑
            if (this.clickTabFlag) {
                return
            }
            console.log(!$idsTop[$idsTop.length - 1])
            if (!$idsTop[$idsTop.length - 1]) {
                $idsTop = arr.map(item => {
                    const itemTop = document.getElementById(item)?.offsetTop
                    return itemTop
                })
            }
            const scrollTop = document.documentElement.scrollTop || document.body.scrollTop
            // 倒序查找
            let curLocal = 0
            for (let len = $idsTop.length, i = len - 1; i >= 0; i--) {
                let item = $idsTop[i]
                if (scrollTop + 1 >= item) {
                    curLocal = i
                    break
                }
            }
            // 设置对应tabName
            this.tabsName = arr[curLocal]
            // 加载组件时重新计算高度
            if (!this.ifLoadComponent(this.tabsName)) {
                this.diyWindowResize()
            }
            // 按需加载组件
            this.loadComponent.add(this.tabsName)
            // 下滑过快可能导致计算高度不准确，下滑到最底部再重新计算
            if ($(document).scrollTop() + $(window).height() >= $(document).height() - 1) {
                setTimeout(() => {
                    this.diyWindowResize()
                }, 500)
            }
        })
        this.screenWidth = document.documentElement.clientWidth - this.topHeight
        this.screenHeight = document.documentElement.clientHeight - this.topHeight
        window.addEventListener('resize', () => {
            this.screenWidth = document.documentElement.clientWidth - this.topHeight
            this.screenHeight = document.documentElement.clientHeight - this.topHeight
            $idsTop = arr.map(item => {
                const itemTop = document.getElementById(item)?.offsetTop
                return itemTop
            })
        })
    },
    beforeDestroy () {
        this.$notify.closeAll()
    },
    methods: {
        ...mapMutations(['setAuditParams']),
        inputblur (row, val) {
            row[val] = isNaN(parseFloat(row[val])) ? 0 : parseFloat(row[val])
        },
        handleNotice () {
            this.dialogVisible = true
        },
        noticeSave (content) {
            this.formData.tenderNotice = content
        },
        getAuditHistory () {
            auditRequest.getAuditHistory(this.auditParams).then(res => {
                this.$refs.ComExaHistory.tableData = res
                this.$refs.ComExaHistory.pagination.total = res.length
            })
        },
        saveAllData (notice = true) {
            return new Promise(resolve => {
                notice
                // 基础信息更新
                const promise1 = this.applyUpdate()
                // // 拟招标内容明细更新
                const promise2 = (() => {
                    if (this.$refs?.ComDetailsOfProposedIndex) {
                        return this.$refs.ComDetailsOfProposedIndex.save()
                    }
                })()
                // // 招标清单保存（更新）
                const promise3 = (() => {
                    if (this.$refs.ComtenderListIndex) {
                        return this.$refs.ComtenderListIndex.save()
                    }
                })()
                // // 公文文件保存
                // const promise4 = this.$refs.ComFilesIndex.save()
                Promise.all([promise1, promise2, promise3]).then(() => {
                    resolve()
                    if (!notice) return
                    this.clientPop('suc', '保存成功')
                })
            })
        },
        async exas (arg, routeTo) {
            if (arg === 'audit') {
                // 包件验证
                if (!this.$refs.ComDetailsOfProposedIndex.detailRule()) return
                // 清单验证
                if (!this.$refs.ComtenderListIndex.tenderListRule()) return
                this.saveAllData(false)
                this.setAuditParams(this.auditParams)
                // 客户端弹窗弹出本地页面
                openAppClient(
                    '/exaDialog',
                    '填写审核意见',
                    () => {
                        const auditParams = JSON.parse(localStorage.vuex).auditParams
                        if (auditParams.opinion === '') {
                            this.clientPop('err', '审核意见未填')
                            return
                        }
                        auditRequest.audit(auditParams).then(() => {
                            if (auditParams.isPass) {
                                this.clientPop('suc', '审核成功', routeTo)
                            } else {
                                this.clientPop('suc', '返回修改成功', routeTo)
                            }
                            this.getCurrentUnitInfo()
                            this.getData()
                            this.$refs.ComExaHistory.getAuditHistory()
                            this.$refs.ComBidButtons.getButtonState() // 刷新招标按钮
                        })
                    },
                    null,
                    null,
                    null,
                    'small'
                )
            } else if (arg === 'undoAudit') {
                this.clientPop('info', '确定要撤回上一步审核操作吗？', () => {
                    auditRequest.undoAudit(this.auditParams).then(() => {
                        this.clientPop('suc', '撤回成功', routeTo)
                        this.getData() // 刷新基础信息
                        this.getCurrentUnitInfo()
                        this.getData()
                        this.$refs.ComExaHistory.getAuditHistory()
                    })
                })
            } else if (arg === 'submitCommit') {
                // 包件验证
                if (!this.$refs.ComDetailsOfProposedIndex.detailRule()) return
                // 清单验证
                if (!this.$refs.ComtenderListIndex.tenderListRule()) return
                // 保存所有信息
                const promise1 = await this.saveAllData(false)
                //   审核
                const promise2 = auditRequest.commit(this.auditParams)
                await Promise.all([promise1, promise2]).then(() => {
                    this.clientPop('suc', '保存并提交成功', routeTo)
                    this.getCurrentUnitInfo()
                    this.getData()
                    this.$refs.ComExaHistory.getAuditHistory()
                })
                // 重置
                this.loadComponent = new Set()
                this.getData()
                this.$route.query.seat = this.tabsName
                this.ifSeat()
            } else if (arg === 'submit') {
                await this.saveAllData()
                // 重置
                this.$route.query.seat = this.tabsName
                this.ifSeat()
            } else if (arg === 'nullify') {
                this.setAuditParams(this.nullifyParams)
                // 客户端弹窗弹出本地页面
                openAppClient(
                    '/nullifyDialog',
                    '单据作废原因',
                    () => {
                        const auditParams = JSON.parse(localStorage.vuex).auditParams
                        commonRequest.nullify(auditParams).then(() => {
                            this.clientPop('suc', '作废成功', routeTo)
                            this.getCurrentUnitInfo()
                            this.getData()
                            this.$refs.ComExaHistory.getAuditHistory()
                        })
                    },
                    null,
                    null,
                    null,
                    'small'
                )
            } else if (arg === 'deleteData') {
                this.clientPop('info', '确定要删除吗？数据删除后不可恢复，请谨慎操作！', () => {
                    equipmentProcurementRequest.applyDelete({ id: this.tenderId }).then(() => {
                        const callBack = () => {
                            this.$router.push('./equipmentBiddingApplication')
                        }
                        this.clientPop('suc', '删除成功', callBack)
                    })
                })
            }
        },
        async getCurrentUnitInfo () {
            await auditRequest.getCurrentUnitInfo(this.auditParams).then(res => {
                this.auditState = res
                console.log('this.auditState', this.auditState)
            })
        },
        audit () {
            this.setAuditParams(this.auditParams)
            // 客户端弹窗弹出本地页面
            openAppClient(
                '/exaDialog',
                '填写审核意见',
                () => {
                    const auditParams = JSON.parse(localStorage.vuex).auditParams
                    auditRequest.audit(auditParams).then(() => {
                        this.clientPop('suc', '审核成功')
                        this.getCurrentUnitInfo()
                    })
                },
                null,
                null,
                null,
                'small'
            )
        },
        undoAudit () {
            auditRequest.undoAudit(this.auditParams).then(() => {
                this.clientPop('suc', '撤回成功')
                this.getCurrentUnitInfo()
            })
        },
        deleteData (type) {
            if (type === 'tender') {
                this.clientPop(
                    'info',
                    '确定要删除吗？数据删除后不可恢复，请谨慎操作！',
                    this.delData
                )
            } else {
                const length = this.$refs.ComFilesIndex.selection.length
                this.clientPop(
                    'info',
                    `已选择【${length}】条数据，确定要删除吗？数据删除后不可恢复，请谨慎操作！`,
                    this.delFiles
                )
            }
        },
        downFile () {
            this.$refs.ComFilesIndex.downFile()
        },
        delFiles () {
            this.$refs.ComFilesIndex.delFiles()
        },
        diyWindowResize () {
            if (document.createEvent) {
                var event = document.createEvent('HTMLEvents')
                event.initEvent('resize', true, true)
                window.dispatchEvent(event)
            } else if (document.createEventObject) {
                window.fireEvent('onresize')
            }
        },
        ifLoadComponent (component) {
            return this.loadComponent.has(component)
        },
        ifSeat () {
            if (this.$route.query.seat) {
                this.tabsName = this.$route.query.seat
                this.onChangeTab(this.$route.query.seat)
            }
        },
        showBidding () {},
        handleClose () {
            this.$router.push('./equipmentBiddingApplication')
        },
        // 获取最后一个内容区域的高度，计算底部空白
        getLastConHeight (arr) {
            let si = setInterval(() => {
                // 因为dom异步加载，通过轮询找到渲染后的dom，获取高度
                if (document.getElementById(arr[length - 1] + 'Con')) {
                    const lastConHeight = document.getElementById(
                        arr[length - 1] + 'Con'
                    )?.offsetHeight
                    this.lastConHeight = lastConHeight
                    clearInterval(si)
                    si = null
                }
            }, 100)
        },
        onChangeTab (e) {
            if (!e.name) {
                let temp = e
                e = {}
                e.name = temp
            }
            $.scrollTo(`#${e.name}`, 500)
            // 如果手动点击时，则不做滚动事件逻辑，只有滚动屏幕时才走滚动事件逻辑
            this.clickTabFlag = true
            // 动画结束后，恢复状态
            setTimeout(() => {
                this.clickTabFlag = false
            }, 600)
            // 加载组件时重新计算高度
            if (!this.ifLoadComponent(this.tabsName)) {
                this.diyWindowResize()
            }
            // 按需加载组件
            this.loadComponent.add(e.name)
        },
        openNewPage (name) {
            this.$notify.closeAll()
            if (name === 'OrgSelectData') {
                const params = JSON.stringify({
                    // 正式环境应该不用转换
                    title: '申请机构',
                    url: '/hr/org/getChildrenOrg',
                    method: 'get',
                    params: { orgId: this.$store.state.userInfo.orgInfo.orgId },
                    tableColumnAttr: this.orgSelectTableColumnAttr,
                    tableColumnWidth: this.selectTableColumnWidth,
                    ifPagination: 0
                })
                this.$notify({
                    title: '申请机构',
                    dangerouslyUseHTMLString: true,
                    message: `正式环境：客户端打开新页面<br>
                测试环境：手动打开新页面<br>
                <textarea cols="35" rows="10">http://localhost:8080/selectData?params=${params}</textarea>
                <br><br>
                回调参数：<br>
                <textarea cols="35" rows="3" id="callBackData"></textarea><br>
                <button id="getPopData">执行回调方法</button>
                `,
                    duration: 0
                })
                document.querySelector('#getPopData').addEventListener('click', this.orgGetPopData)
            } else if (name === 'docSelectData') {
                const params = JSON.stringify({
                    // 正式环境应该不用转换
                    title: '选择公文',
                    url: '/tender/document/listByEntity',
                    method: 'post',
                    params: {
                        departCode: 'DQGSGJGSZCB1-1',
                        userNumber: localStorage.getItem('userNumber'),
                        endDateTime: '',
                        key: '',
                        startDateTime: ''
                    }, // 暂时写死
                    tableColumnAttr: this.docSelectTableColumnAttr,
                    tableColumnWidth: this.selectTableColumnWidth,
                    ifPagination: 1,
                    selectMode: 1,
                    keyWord: 'docNum',
                    searchKey: 'key'
                })
                this.$notify({
                    title: '选择公文',
                    dangerouslyUseHTMLString: true,
                    message: `正式环境：客户端打开新页面<br>
                测试环境：手动打开新页面<br>
                <textarea cols="35" rows="10">http://localhost:8080/selectData?params=${params}</textarea>
                <br><br>
                回调参数：<br>
                <textarea cols="35" rows="3" id="callBackData"></textarea><br>
                <button id="getPopData">执行回调方法</button>
                `,
                    duration: 0
                })
                document.querySelector('#getPopData').addEventListener('click', this.docGetPopData)
            }
        },
        docGetPopData () {
            const callBackData =
                document.querySelector('#callBackData').value &&
                JSON.parse(document.querySelector('#callBackData').value)
            const mapCallBackData = []
            callBackData.forEach(() => {
                mapCallBackData.push({
                    createUser: '',
                    dispatNum: '',
                    documentNo: '',
                    filePath: '',
                    name: '',
                    oaCreatTime: ''
                })
            })
            callBackData.forEach((value, key) => {
                mapCallBackData[key].createUser = value.userName
                mapCallBackData[key].dispatNum = value.dispatNum
                mapCallBackData[key].documentNo = value.docNum
                mapCallBackData[key].filePath = value.docStr
                mapCallBackData[key].name = value.name
                mapCallBackData[key].oaCreatTime = value.oaCreateTime
            })
            applyRequest
                .documentCreate({
                    billId: this.formData.billId,
                    documentModels: mapCallBackData,
                    orgId: this.formData.tenderUserId,
                    orgName: this.formData.tenderUser
                })
                .then(() => {
                    this.$refs.ComFilesIndex.documentListByEntity()
                })
        },
        orgGetPopData () {
            const callBackData = JSON.parse(document.querySelector('#callBackData').value)
            this.formData.applyOrgId = callBackData.orgId
            this.formData.applyOrgName = callBackData.orgName
            console.log(this.formData)
        },
        currentTabComponent (name) {
            return this.currentTabComponentName === name
        },
        selectChange (kvId, label) {
            if (label === '采购方式') {
                this.options.tenderForm.forEach(item => {
                    if (kvId === item.value) {
                        this.formData.tenderFormName = item.label
                    }
                })
            } else if (label === '币种') {
                let index
                this.options.currency.forEach((item, key) => {
                    if (item.kvValue === kvId) {
                        index = key
                        this.formData.currency = item.kvKey
                    }
                })
                authRequest
                    .getRmbRate({
                        currency: index,
                        orgId: this.userInfo.orgInfo.orgId
                    })
                    .then(res => {
                        this.formData.rmbRate = res.rate
                        this.formData.rmbAmount = this.formData.tenderAmount * res.rate
                    })
                    .catch(() => {
                        this.formData.rmbRate = 0
                    })
            } else if (label === '目标预算') {
                ;('等待接口')
            }
        },
        noFocus () {
            this.$refs.noFocus.blur()
        },
        toRouter (path) {
            this.$router.push({
                path,
                query: { tenderId: this.tenderId }
            })
        },
        delData () {
            applyRequest.tenderApplyDeleteBatch([this.tenderId]).then(() => {
                const callBack = () => {
                    this.$router.push('./equipmentBiddingApplication')
                }
                this.clientPop('suc', '删除成功', callBack)
            })
        },
        async getData () {
            await equipmentProcurementRequest.applyGetById({ id: this.tenderId }).then(res => {
                this.formData = res
                this.cloneFormDataStr = JSON.stringify(res)
                // res
            })
            // 以下是关于招标条款引入在线word文档的代码
            // if (!this.formData.tenderClausePath) {
            //     axios
            //         .post('/node/generate', {
            //             billId: this.$route.query.billid,
            //             token: localStorage.getItem('token'),
            //             org: encodeURIComponent(JSON.stringify(store.state.userInfo.orgInfo)),
            //             module: 'sbcgzb' // 设备采购招标
            //         })
            //         .then(res => {
            //             const data = JSON.parse(res.data.body)
            //             const fileName = encodeURI(data.filename)
            //             this.formData.tenderClausePath = `http://192.168.100.100:1027/getFileUrl?fileName=${fileName}`
            //         })
            // }
        },
        applyUpdate () {
            return new Promise((resolve, reject) => {
                // 基础验证
                this.$refs.ruleForm.validate(async valid => {
                    if (valid) {
                        // 基础信息更新
                        equipmentProcurementRequest.applyUpdate(this.formData).then(() => {
                            this.getData()
                            resolve()
                        })
                    } else {
                        this.onChangeTab({ name: 'baseInfo' })
                        reject()
                    }
                })
            })
        },
        submitCommit () {
            const promise1 = applyRequest.tenderApplyUpdate(this.formData)
            const promise2 = auditRequest.commit(this.auditParams)
            Promise.all([promise1, promise2]).then(() => {
                this.clientPop('suc', '保存并提交成功')
                this.getCurrentUnitInfo()
            })
        },
        // handleClose () {
        //     // this.dialogVisible = false
        //     this.$router.push('./equipmentBiddingApplication')
        // },
        cellClsNm ({ column }) {
            if (column.label === '') {
                return 'fixed-left'
            }
        },
        cellMouseEnter (row) {
            this.MouseEnterId = row.id
        },
        cellMouseLeave () {
            this.MouseEnterId = 0
        }
    }
}
</script>

<style lang="scss" scoped>
.form {
    margin-top: 10px;
}

.e-table {
    background: #fff;

    /* .top {
    .left {
      padding: 20px;
      padding-top: 0px;
    }
  } */
}

.upload {
    margin: 20px auto;
    display: flex;
    justify-content: center;
    text-align: center;
}

.upload-demo {
    display: flex;
    justify-content: center;
    align-items: center;
}
</style>
